{% extends "base.html" %}

{% block content %}
<div class="row">
    <div class="col-md-12 mb-4">
        <div class="card">
            <div class="card-header">
                <h5 class="card-title mb-0">新建筛选任务</h5>
            </div>
            <div class="card-body">
                <form id="taskForm">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label class="form-label">输入目录</label>
                            <div class="input-group">
                                <input type="text" class="form-control" id="inputDir" readonly>
                                <button class="btn btn-outline-secondary" type="button" onclick="selectDirectory('input')">
                                    选择目录
                                </button>
                            </div>
                            <div class="form-text" id="inputStats"></div>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label">输出目录</label>
                            <div class="input-group">
                                <input type="text" class="form-control" id="outputDir" readonly>
                                <button class="btn btn-outline-secondary" type="button" onclick="selectDirectory('output')">
                                    选择目录
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="mt-3">
                        <button type="submit" class="btn btn-primary" id="startButton">开始筛选</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <h5 class="card-title mb-0">任务列表</h5>
            </div>
            <div class="card-body">
                <div id="taskList"></div>
            </div>
        </div>
    </div>
</div>

<!-- 任务卡片模板 -->
<template id="taskTemplate">
    <div class="task-card mb-4">
        <div class="card">
            <div class="card-header">
                <div class="d-flex justify-content-between align-items-center">
                    <h6 class="mb-0">任务 ID: <span class="task-id"></span></h6>
                    <span class="badge task-status"></span>
                </div>
            </div>
            <div class="card-body">
                <div class="progress mb-3">
                    <div class="progress-bar" role="progressbar"></div>
                </div>
                <div class="row">
                    <div class="col-md-3">
                        <small class="text-muted">处理进度:</small>
                        <span class="task-progress">0/0</span>
                    </div>
                    <div class="col-md-3">
                        <small class="text-muted">已用时间:</small>
                        <span class="task-duration">0秒</span>
                    </div>
                    <div class="col-md-3">
                        <small class="text-muted">通过率:</small>
                        <span class="task-pass-rate">0%</span>
                    </div>
                    <div class="col-md-3">
                        <button class="btn btn-sm btn-outline-primary view-results" onclick="viewResults(this)">
                            查看结果
                        </button>
                    </div>
                </div>
                
                <!-- 结果列表 -->
                <div class="results-container mt-3" style="display: none;">
                    <h6>处理结果</h6>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="list-group filtered-list">
                                <div class="list-group-item active">
                                    未通过图片
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="list-group passed-list">
                                <div class="list-group-item active">
                                    已通过图片
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
{% endblock %} 